<div>
  <div class="main-title">
    <h2>到账账单</h2>
  </div>
  <div class="main-section form-inline">
    <select class="j-select form-control" style="width: 120px; margin-left: 2px;">
      <option value="{:url('', ['house_property_id' => 0])}">未选择</option>
      {foreach $properties as $v}
      <option value="{:url('', ['house_property_id' => $v.id])}" {if $house_property_id==$v.id}selected{/if}>
        {$v.name}
      </option>
      {/foreach}
    </select>
    <p class="form-control-static">今日到账金额：{$sum}</p>
  </div>
  <div class="main-section">
    <table class="table table-striped table-bordered table-hover">
      <thead>
        <tr>
          <th>房产</th>
          <th>房号</th>
          <th>租期</th>
          <th>总金额</th>
          <th>到账时间</th>
        </tr>
      </thead>
      <tbody>
        {if $property}
        {foreach $billing as $v}
        <tr>
          <td>{$property.name}</td>
          <td>{$v.number_name}</td>
          {if $v.start_time}
          <td>{$v.start_time|date='Y-m-d'} - {$v.end_time|date='Y-m-d'}</td>
          {else}
          <td></td>
          {/if}
          <td>{$v.total_money}</td>
          <td>{$v.accounting_date|date='Y-m-d'}</td>
        </tr>
        {/foreach}
        {/if}
        {if empty($property) || $billing->isEmpty()}
        <tr>
          <td colspan="10" class="text-center">列表为空</td>
        </tr>
        {/if}
      </tbody>
    </table>
    {$billing|raw}
  </div>
</div>

<script>
  $('.j-del').click(function () {
    if (confirm('您确定要删除此项？')) {
      main.ajaxPost($(this).attr('href'), function () {
        main.contentRefresh();
      });
    }
    return false;
  });
  $('.j-select').change(function () {
    main.content($(this).val());
  });
</script>